//
//  MenuViewController.m
//  Lianxi2
//
//  Created by lanou on 16/7/2.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "MenuViewController.h"

@interface MenuViewController ()<UITableViewDataSource,UITableViewDelegate>

@property (nonatomic,strong)UITableView *tableview;

@end

@implementation MenuViewController
- (UITableView *)tableview{
    if (!_tableview) {
        _tableview = [[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];
        _tableview.dataSource = self;
        _tableview.delegate = self;
        _tableview.contentInset = UIEdgeInsetsMake(200, 0, 0, 0);
    }
    return _tableview;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"menu_cell" forIndexPath:indexPath];
    cell.backgroundColor = [UIColor greenColor];
    cell.textLabel.text = self.titleArray[indexPath.row];
    return cell;
    
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.titleArray.count;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if ([self.delegate respondsToSelector:@selector(menuViewControllerDidClickCellWithVC:)]) {
        RightViewController *rightVC = self.controllerArray[indexPath.row];
        rightVC.isSlider = NO;
        [self.delegate menuViewControllerDidClickCellWithVC:rightVC];
    }
}


- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    [self.tableview registerClass:[UITableViewCell class] forCellReuseIdentifier:@"menu_cell"];
    
    [self.view addSubview:self.tableview];
    
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
